package cloning.my;

public class CloningExample {

	public static void main(String[] args) {

		ShallowSimpleObject so1 = new ShallowSimpleObject();
		so1.setInner(new InnerObject());
		ShallowSimpleObject shallowCopy = so1.clone();

		System.out.println("======= shallow ========");
		System.out.println(so1 + " has " + so1.getInner());
		System.out.println(shallowCopy + " has " + shallowCopy.getInner());

		DeepSimpleObject do1 = new DeepSimpleObject();
		do1.setInner(new InnerObject());
		DeepSimpleObject deepCopy = do1.clone();

		System.out.println("======= deep ========");
		System.out.println(do1 + " has " + do1.getInner());
		System.out.println(deepCopy + " has " + deepCopy.getInner());
	}

}
